﻿<%@ Page Title="New Item" Language="C#" MasterPageFile="~/Pages/user/userMaster.Master" AutoEventWireup="true" CodeBehind="NewItem.aspx.cs" Inherits="WarehouseWebAPP.Pages.user.New_Entities.NewItem" %>
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <table class="style1">
        <tr>
            <td>
                <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                    <ContentTemplate>
                        <asp:DetailsView ID="DetailsView1" runat="server" AllowPaging="True" 
                    AutoGenerateRows="False" CellPadding="4" DataKeyNames="lend_item_num" 
                    DataSourceID="ItemObjectDataSource" DefaultMode="Insert" ForeColor="#333333" 
                    GridLines="None" Height="50px" Width="433px">
                            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                            <CommandRowStyle BackColor="#E2DED6" Font-Bold="True" />
                            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                            <FieldHeaderStyle BackColor="#E9ECF1" Font-Bold="True" />
                            <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                            <Fields>
                                <asp:BoundField DataField="lend_item_num" HeaderText="lend_item_num" 
                            ReadOnly="True" SortExpression="lend_item_num" Visible="False" />
                                <asp:TemplateField HeaderText="Item Serial Number" 
                            SortExpression="lend_item_serial">
                                    <EditItemTemplate>
                                        <asp:TextBox ID="TextBox1" runat="server" 
                                    Text='<%# Bind("lend_item_serial") %>'></asp:TextBox>
                                    </EditItemTemplate>
                                    <InsertItemTemplate>
                                        <asp:TextBox ID="TextBox1" runat="server" 
                                    Text='<%# Bind("lend_item_serial") %>'></asp:TextBox>
                                        <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" 
                                    ControlToValidate="TextBox1" ErrorMessage="*"></asp:RequiredFieldValidator>
                                        <asp:CustomValidator ID="CustomValidator1" runat="server" 
                                    ControlToValidate="TextBox1" ErrorMessage="Already Exist." 
                                    onservervalidate="CustomValidator1_ServerValidate"></asp:CustomValidator>
                                    </InsertItemTemplate>
                                    <ItemTemplate>
                                        <asp:Label ID="Label2" runat="server" Text='<%# Bind("lend_item_serial") %>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:CheckBoxField DataField="lend_item_available" 
                            HeaderText="Availability" SortExpression="lend_item_available" 
                            Visible="False" />
                                <asp:BoundField DataField="lend_item_description" HeaderText="Description" 
                            SortExpression="lend_item_description" />
                                <asp:BoundField DataField="lend_item_place" HeaderText="Location" 
                            SortExpression="lend_item_place" />
                                <asp:TemplateField HeaderText="Supplier" 
                            SortExpression="lend_item_supplier">
                                    <EditItemTemplate>
                                        <asp:DropDownList ID="DropDownList1" runat="server" 
                                    DataSourceID="SupplierObjectDataSource" DataTextField="supplier_name" 
                                    DataValueField="supplier_num" 
                                    SelectedValue='<%# Bind("lend_item_supplier") %>'>
                                        </asp:DropDownList>
                                        <asp:ObjectDataSource ID="SupplierObjectDataSource" runat="server" 
                                    SelectMethod="SupplierGet" TypeName="WarehouseWebAPP.code.BLL.SupplierBLL">
                                        </asp:ObjectDataSource>
                                    </EditItemTemplate>
                                    <InsertItemTemplate>
                                        <cc1:ComboBox ID="ComboBox1" runat="server" AppendDataBoundItems="True" 
                                            AutoCompleteMode="Append" DataSourceID="SupplierObjectDataSource" 
                                            DataTextField="supplier_name" DataValueField="supplier_num" 
                                            DropDownStyle="DropDownList" MaxLength="0" 
                                            SelectedValue='<%# Bind("lend_item_supplier") %>' style="display: inline;">
                                        </cc1:ComboBox>
                                        <asp:ObjectDataSource ID="SupplierObjectDataSource" runat="server" 
                                    SelectMethod="SupplierGet" TypeName="WarehouseWebAPP.code.BLL.SupplierBLL">
                                        </asp:ObjectDataSource>
                                    </InsertItemTemplate>
                                    <ItemTemplate>
                                        <asp:Label ID="Label1" runat="server" Text='<%# Bind("lend_item_supplier") %>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Vendor" 
                            SortExpression="lend_item_vendor">
                                    <EditItemTemplate>
                                        <asp:DropDownList ID="DropDownList2" runat="server" 
                                    DataSourceID="VendorObjectDataSource" DataTextField="vendor_name" 
                                    DataValueField="vendor_num" 
                                    SelectedValue='<%# Bind("lend_item_vendor") %>'>
                                        </asp:DropDownList>
                                        <asp:ObjectDataSource ID="VendorObjectDataSource" runat="server" 
                                    SelectMethod="VendorGet" TypeName="WarehouseWebAPP.code.BLL.VendorBLL">
                                        </asp:ObjectDataSource>
                                    </EditItemTemplate>
                                    <InsertItemTemplate>
                                        <cc1:ComboBox ID="ComboBox2" runat="server" AppendDataBoundItems="True" 
                                            AutoCompleteMode="Append" DataSourceID="VendorObjectDataSource" 
                                            DataTextField="vendor_name" DataValueField="vendor_num" 
                                            DropDownStyle="DropDownList" MaxLength="0" 
                                            SelectedValue='<%# Bind("lend_item_vendor") %>' style="display: inline;">
                                        </cc1:ComboBox>
                                        <asp:ObjectDataSource ID="VendorObjectDataSource" runat="server" 
                                    SelectMethod="VendorGet" TypeName="WarehouseWebAPP.code.BLL.VendorBLL">
                                        </asp:ObjectDataSource>
                                    </InsertItemTemplate>
                                    <ItemTemplate>
                                        <asp:Label ID="VendorLabel" runat="server" 
                                    Text='<%# Bind("lend_item_vendor") %>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:CommandField ShowInsertButton="True" />
                            </Fields>
                            <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                            <EditRowStyle BackColor="#999999" />
                            <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                        </asp:DetailsView>
                    </ContentTemplate>
                </asp:UpdatePanel>
                <asp:ObjectDataSource ID="ItemObjectDataSource" runat="server" 
                    InsertMethod="LendItemInsert" SelectMethod="lendItemGet" 
                    TypeName="WarehouseWebAPP.code.BLL.LendItemBLL">
                    <InsertParameters>
                        <asp:Parameter Name="lend_item_serial" Type="String" />
                        <asp:Parameter DbType="Guid" Name="lend_item_vendor" />
                        <asp:Parameter Name="lend_item_description" Type="String" />
                        <asp:Parameter Name="lend_item_place" Type="String" />
                        <asp:Parameter DbType="Guid" Name="lend_item_supplier" />
                    </InsertParameters>
                </asp:ObjectDataSource>
            </td>
        </tr>
    </table>
</asp:Content>
